package test.BIO;

import java.io.IOException;
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;

public class BioServer {
    public static void main(String[] args) {
        try {
            ServerSocket serverSocket = new ServerSocket();
            serverSocket.bind(new InetSocketAddress(9099));
            Socket accept = serverSocket.accept();
            while(true) {
                InputStream inputStream = accept.getInputStream();
                byte [] buffer = new byte[1024];
                inputStream.read(buffer);
                System.out.println("接收到的数据：" + new String(buffer));
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
